<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title></title>
</head>
<body>
	<script type="text/javascript">
	var obj1={
		name:'jan',
		age:100,
		desc:['son1','son2']
	};
	var obj2={
		name:'jone',
		age:30
	};
	var obj3={
		test1:'test1-value',
		test2:'test2-value',
		items:[{
			key:'key-....'
		},{
			val:'val-....'
		}]
	};
	
	function isEmptyObject(inObj){
		for(var key in inObj){
			return false;
		}
		return true;
	}
	
	/*
	1.foreach obj1;
	
	
	*/
	var is = function (obj,type) {
	  var toString = Object.prototype.toString,undefined;
	  return (type === "Null" && obj === null) ||
		(type === "Undefined" && obj === undefined ) ||
		toString.call(obj).slice(8,-1) === type;
	};
	/*
		让目标对象具有源对象上的所有属性
		仅一层复制
	*/
	function extend(inTarget,inSource){
		var val,key;
		for (key in inSource) {
			val=inSource[key];
			if(inSource === val) continue; //window.window===window;
			if(is(val,'Object')){//todo:判断引用类型，值类型isRef/isValu
				inTarget[key] = arguments.callee(inSource[key] || [], val);
			}else if(is(val,'Array')){
				inTarget[key] = arguments.callee(inSource[key] || [], val);
			}else{
				inTarget[key] = val;
			}
		}
		return inTarget;
	}
	
	function clone(inObj){
		/*
		var result;
		for(var key in inObj){
			if(!inSource.hasOwnProperty(key)) continue;
			result[key]=inObj[key];
		}
		return result;
		*/
		return extend({},inObj);
	}
	
	/*
		扁平化？
	*/
	var obj4={
		options:{
			opt1:'opt1-value',
			opt2:'opt2-value'
		}
	};
	
	
	var toArray=function(){
	
	};
	
	var obj5=toArray(obj4);
	obj5={
		options_opt1:'opt1-value',
		options_opt2:'opt2-value'
	};
	
	
	
	
	
	
	</script>
</body>
</html>